﻿

function openDIV(title,value){
	var _showDIV=window.top.document.getElementById('open_win_div');//.getElementById('open_win_div');
	var _bgDIV=window.top.document.getElementById('open_win_bg_div');
	
	value=appendWindow(title,value);
	//alert(value);
	//Estop('open_win_div');
	_showDIV.style.display='block';
	_showDIV.innerHTML = value;
	_bgDIV.style.display='block';
}

function openDIV(width,height,title,value){
	var _showDIV=window.top.document.getElementById('open_win_div');//.getElementById('open_win_div');
	var _bgDIV=window.top.document.getElementById('open_win_bg_div');
	
	updateDIVWidthAndHeight(width,height)
	value=appendWindow(title,value);
	//alert(value);
	//Estop('open_win_div');
	_showDIV.style.display='block';
	_showDIV.innerHTML = value;
	_bgDIV.style.display='block';
}

function appendWindow(title,value){
	var win='<table width="100%" border="0" cellpadding="3" cellspacing="0"><tr><td width="90%" class="box_title">'+title+'</td><td width="10%" align="center" class="box_title"><a onclick="closeDIV()" class="mouse_hand">关闭</a></td></tr><tr><td colspan="2" valign="top">'+value+'</td></tr></table>';
	return win;
}

function closeDIV(){
	var _showDIV=document.getElementById('open_win_div');//.getElementById('open_win_div');
	var _bgDIV=document.getElementById('open_win_bg_div');

	//alert(_showDIV.innerHTML);
	//Estop('open_win_div');
	
	_showDIV.innerHTML = "";
	_showDIV.style.display='none';
	_bgDIV.style.display='none';
}

function closeTopDIV(){
	var _showDIV=window.top.document.getElementById('open_win_div');//.getElementById('open_win_div');
	var _bgDIV=window.top.document.getElementById('open_win_bg_div');

	//alert(_showDIV.innerHTML);
	//Estop('open_win_div');
	
	_showDIV.innerHTML = "";
	_showDIV.style.display='none';
	_bgDIV.style.display='none';
}

/**
动态更新DIV的位置,宽高
**/
function updateDIVWidthAndHeight(width,height){
	//var _showDIV=window.top.window.document.getElementById('open_win_div');
	var _showDIV=window.top.document.getElementById('open_win_div');
	_showDIV.style.width=width+"px";
	_showDIV.style.height=height+"px";
	_showDIV.style.marginLeft=(-(width/2))+"px";
	_showDIV.style.marginRight=(width/2) + "px";
	_showDIV.style.marginTop=(-(height/2))+"px";
}